<template>
     <div class="page">
         <goback></goback>
        <div class="main">
        <div class="tu">
         <img :src="'http://localhost:3000'+detail.img" alt="pic">
        </div>
        <div class="
        jianjie">
        <div class="div1">
            <p><i>&yen;</i><span>{{detail.market_price}}</span><del>&yen;{{detail.price}}</del></p>
            <div class="sc">
                <em class="iconfont">&#xe634;
                </em>
                收藏
            </div>
        </div>
        <div class="div2">
            <p class="p1">{{detail.goodsname}}</p>
            <p class="p2" v-html="detail.description"></p>
        </div>
        <div class="div3">
            <p class="p3">11.11限时299元起</p>
        </div>
        <div class="div4 clearfix">
            <p class="fl">{{detail.specsname}}</p>
           <a href="javascript:;" class="fr" v-for="item in detail.specsattr" :key="item">{{item}}<em class="iconfont icon-arrow-right
">
        </em></a>
        </div>
        </div>
        <div class="hui"></div>

        <div class="di">
            <div class="juan">
                <h4>领劵</h4>
                <div class="line">
                <p class="p1">300</p>
                <p class="p2">50</p>
                <p class="p2">10</p>
                </div>
            </div>
            <div class="fq clearfix">
                <div class="fl">
                    <p class="fl">分期</p>
                    <p class="fr">可选3/6/12期</p>
                </div>
                <div class="fr">
                    <em class="iconfont">&#xe63c;
                    </em>
                </div>
            </div>
        </div>


    <div class="de">
        <div class="zuoh clearfix">
        <div class="mmm fl">
        <a href="#">
            <img :src='require("../../assets/img/hotline.png")' alt="pic">
            <p>客服</p>
        </a>
        <a href="#">
            <img :src='require("../../assets/img/pic3.png")' alt="pic">
            <p>店铺</p>
        </a>
        <a href="javascript:;">
            <img :src='require("../../assets/img/shoppingcart.png")' alt="pic">
            <p>购物车</p>
        </a>
        </div>
        <div class="hhh fr">
            <div class="fl" @click="toshop"><p>加入购物车</p>
            </div>
            <div class="fr"><p>立即购买</p></div>
        </div>
        </div>
    </div>
       </div>
   </div>
</template>

<script>
import { reqDetail } from '../../http/api';
import { reqcartadd } from '../../http/api';
import {Toast} from "vant"
export default {
  data(){
    return{
      detail:{},
  }}
  ,
methods:{
    toshop(){
      reqcartadd({
        uid:JSON.parse(localStorage.getItem("user")).uid,
        goodsid:this.detail.id,
        num:1
      }).then(res=>{
          Toast(res.data.msg);
      })
    },
},
mounted(){
     reqDetail({id: this.$route.params.id}).then((res) => {
      this.detail=res.data.list[0]
      this.detail.specsattr=this.detail.specsattr.split(",")
      // console.log(this.detail);
    });
}
}
</script>
<style scoped>
.page {
  max-width: 750px;
  min-width: 320px;
  margin: 0 auto;
}
.tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 0.89rem;
  padding: 00.89rem 0.12rem 0 .34rem;
  background: #ff6040;
}
.tool .back {
  font-size: 0.35rem;
  color: #ffdfd8;
}
.tool p {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  font: 0.4rem "微软雅黑";
  color: #ffdfd8;
}
.tool .menu {
  display: flex;
  justify-content: space-around;
  align-items: center;
  width: 1.72rem;
  height: .63rem;
  border: 1px solid #ff866c;
  border-radius: .3rem;
}
.tool .menu .line {
  height: 0.37rem;
  width: 1px;
  background: #ff896e;
}
.tool .menu em {
  font-size: 00.35rem;
  color: #ffdfd8;
}
.jiao {
  position: fixed;
  width: 100%;
  left: 0;
  bottom: 0;
  height: 1.17rem;
  border-top: 1px solid #cccccc;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.jiao a {
  display: block;
  text-align: center;
}
.jiao a:first-child p {
  color: #ff6040;
}
.jiao a img {
  height: .4rem;
  width: auto;
}
.jiao p {
  font: 0.2rem/0.49rem "微软雅黑";
  color: #9b9b9b;
}
.header {
  background-image: linear-gradient(180deg, #ff6040, #ff7b68);
}
form {
  position: relative;
}
form input {
  width: 3.36rem;
  height: 0.6rem;
  border: .02rem solid #e6e6e6;
  background: #ffffff;
  text-indent: 0.67rem;
  border-radius: 0.05rem;
  font: 0.27rem/0.6rem "微软雅黑";
  color: #999999;
}
form .ss {
  position: absolute;
  left: .14rem;
  top: .15rem;
  color: #9a9a9a;
}
.navber {
  background-image: linear-gradient(180deg, #ff7b69, #ff897e);
}
.navber > ul {
  padding-bottom: .04rem;
  display: flex;
  justify-content: space-around;
}
.navber > ul li:nth-child(1) a {
  position: relative;
  font-size: 0.31rem;
  font-weight: bold;
}
.navber > ul li:nth-child(1) a::after {
  position: absolute;
  left: 50%;
  bottom: -0.04rem;
  transform: translateX(-50%);
  content: "";
  display: block;
  width: .4rem;
  height: 0.04rem;
  background: #fff;
  border-radius: .02rem;
}
.navber > ul li a {
  display: block;
  font: 0.27rem "微软雅黑";
  color: #fff;
}
.main .tu {
  width: auto;
  height: 7.5rem;
}
.main .tu img {
  width: 100%;
  height: auto;
}
.jianjie {
  margin: 0 .2rem;
}
.jianjie .div1 {
  display: flex;
  justify-content: space-between;
}
.jianjie .div1 p {
  font: 0.3rem/0.44rem Arial;
  color: #999999;
}
.jianjie .div1 p i {
  color: #ff6040;
}
.jianjie .div1 p span {
  margin-right: .12rem;
  font: 0.63rem/0.67rem Arial;
  color: #ff6040;
}
.jianjie .div1 .sc {
  display: flex;
  flex-direction: column;
  font: 0.19rem "微软雅黑";
  color: #ff795e;
  text-align: center;
}
.jianjie .div1 .sc em {
  font-size: .21rem;
}
.jianjie .div2 .p1 {
  font: 0.3rem "微软雅黑";
  color: #333333;
}
.jianjie .div2 .p2 {
  font: 0.26rem "微软雅黑";
  color: #999999;
}
.jianjie .div3 {
  margin-top: .24rem;
  width: 1.76rem;
  height: .32rem;
  background: #ff8066;
}
.jianjie .div3 p {
  font: 0.2rem/0.32rem "微软雅黑";
  color: white;
  text-align: center;
}
.jianjie .div4 {
  margin-top: .21rem;
  height: 0.4rem;
  background: #f2f2f2;
  padding: 0 .04rem;
}
.jianjie .div4 p {
  font: 0.18rem/0.4rem "微软雅黑";
  color: #a9a9a9;
  margin-left: .1rem;
}
.jianjie .div4 a {
  font: 0.19rem/0.4rem "微软雅黑";
  color: #ff6040;
}
.hui {
  margin-top: .16rem;
  height: .2rem;
  width: 100%;
  background: #f2f2f2;
}
.di{
    padding-bottom: .9rem;
}
.di .juan {
  display: flex;
  width: 100%;
  height: .9rem;
}
.di .juan h4 {
  font: bold 0.22rem "微软雅黑";
  margin-left: .2rem;
  margin-right: .4rem;
  margin-top: .33rem;
}
.di .juan .line {
  flex-grow: 1;
  height: 0.9rem;
  display: flex;
  align-items: center;
  border-bottom: .02rem solid #e6e6e6;
}
.di .juan .line .p1 {
  font: .21rem Arial;
  color: #8d5728;
  display: block;
  width: .78rem;
  height: .34rem;
  margin-right: .2rem;
  background: url(../../assets/img/full.png) no-repeat;
  background-size: 100%;
  padding-left: 21px;
  padding-top: .07rem;
}
.di .juan .line .p2 {
  font: .21rem Arial;
  color: #8d5728;
  display: block;
  width: .66rem;
  height: .32rem;
  margin-right: .2rem;
  background: url(../../assets/img/full.png) no-repeat;
  
  background-size: 100%;
  padding-left: .21rem;
  padding-top: .07rem;
}
.di .fq {
  margin-top: .21rem;
  height: .44rem;
  border-bottom: 1px solid #cccccc;
}
.di .fq > .fl .fl {
  font: bold 0.22rem/0.44rem "微软雅黑";
  margin-left: .2rem;
}
.di .fq > .fl .fr {
  margin-left: .42rem;
  font: 0.23rem/0.44rem 'w微软雅黑';
  color: #696969;
}
.di .fq > .fr em {
  color: #6d6d6d;
  line-height: .44rem;
  margin-right: .35rem;
}
.de{
    position: fixed;
    bottom: 0;
    left: 0;
}
.de .zuoh .mmm {
  display: flex;
  width: 3.1rem;
  height: .99rem;
  justify-content: space-around;
  align-items: center;
  background-color: white;
}
.de .zuoh .mmm a {
  text-align: center;
  font: 0.19rem "微软雅黑";
  color: #363636;
}
.de .zuoh .mmm a img {
  width: .35rem;
  height: .4rem;
}
.de .zuoh .hhh {
  width: 4rem;
  text-align: center;
}
.de .zuoh .hhh .fl {
  width: 2rem;
  height: .99rem;
  background: #ffcc66;
  font: 0.32rem "微软雅黑";
  color: #663014;
  line-height: .99rem;
}
.de .zuoh .hhh .fr {
  width: 2rem;
  height: .99rem;
  background: #ff6040;
  font: 0.32rem "微软雅黑";
  color: #fff;
  line-height: .99rem;
}
</style>